<?php
namespace Mouta\AmistateBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Validator\ErrorElement;
use Sonata\AdminBundle\Form\FormMapper;
use Mouta\AmistateBundle\utils\Strings;

class AsuntoAdmin extends Admin{
    
    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
            ->add('id', null, array('required' => false,'read_only' => true))
            ->add('asunto', null, array('required' => true))
            ->add('created_at', 'date', array('required' => false,'widget' => 'single_text','format' => 'dd-MM-yyyy','required' => true))
        ;
    }

    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
    {
        $datagridMapper
            ->add('id')
            ->add('created_by.id')
            ->add('created_at')
        ;
    }

    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper
            ->addIdentifier('id')
            ->add('asunto')
            ->add('created_by','doctrine_orm_string',array('label'=>'Creado por'))
            ->add('created_at')
        ;
    }

    
}

?>
